---
{% set lastOrg = "" %}
{% if orderers | length > 0 %}
OrdererOrgs:
{%   for item in orderers %}
{%      if lastOrg != item.org %}

  - Name: {{ item.org }}
    Domain: {{ item.org }}
    Specs: {%      endif %}
      - Hostname: {{ item.name }}
        CommonName: {{ item.name }}.{{ item.org}} {% set lastOrg = item.org %}
{%   endfor %}
{% endif %}

{% set lastOrg = "" %}
{% if peers | length > 0 %}

PeerOrgs:
{%   for item in peers %}
{%      if lastOrg != item.org %}

  - Name: {{ item.org }}
    Domain: {{ item.org }}
    Specs: {%      endif %}
      - Hostname: {{ item.name }}
        CommonName: {{ item.name }}.{{ item.org}} {% set lastOrg = item.org %}
{%   endfor %}
{% endif %}

